package com.andy.basics;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Component;

@Component
public class ModelFactory {

	@PersistenceContext
	private EntityManager entityManager;

	public EntityManager getEntityManager() {
		return entityManager;
	}

	public Object create(String modelName) throws Exception {
		return Class.forName(modelName).newInstance();
	}

	public List createList() {
		return new ArrayList();
	}

	public UniqueValidator createValidator(String model, String field) {
		return null;// new UniqueValidator(entityManager, model, field);
	}

}
